//
//  RequestConstant.swift
//  GreenDeal
//
//  Created by Moennig Q on 4/11/2022.
//

import Foundation
import Alamofire
class RequestConstant: NSObject {
    
    static let defaultHeaders: HTTPHeaders = []
    static var AuthTokenParam: HTTPHeaders {
        let dic = Bundle.main.infoDictionary
        let appVersion : String = dic!["CFBundleShortVersionString"] as! String
        let deviceUUID = UIDevice.current.identifierForVendor!.uuidString//不是UDID,苹果禁用APP获取UDID
//        let sysName = UIDevice.current.systemName //获取系统名称 例如：iPhone OS
        let sysVersion = UIDevice.current.systemVersion //获取系统版本 例如：9.2
        let deviceModelName = UIDevice.current.modelName//extention 获取设备的型号 例如：iPhone
        //customer headers
        var headers = defaultHeaders
        headers.add(name: "X-API-EMAIL", value: APPConfig.loginInfo.email)
        headers.add(name: "X-API-TOKEN", value: APPConfig.loginInfo.access_token)
        headers.add(name: "X-API-MOBILE-TYPE", value: "iOS")
        headers.add(name: "X-API-MOBILE-VERSION", value: appVersion)
        headers.add(name: "X-API-MOBILE-OPERTATING-VERSION", value: sysVersion)
        headers.add(name: "X-API-MOBILE-DEVICE-MODEL", value: deviceModelName)
        headers.add(name: "X-API-MOBILE-UUID", value: deviceUUID)
        return headers
    }
    static var AuthLoginOtherParam: HTTPHeaders {
        let dic = Bundle.main.infoDictionary
        let appVersion : String = dic!["CFBundleShortVersionString"] as! String
        let deviceUUID = UIDevice.current.identifierForVendor!.uuidString//不是UDID,苹果禁用APP获取UDID
//        let sysName = UIDevice.current.systemName //获取系统名称 例如：iPhone OS
        let sysVersion = UIDevice.current.systemVersion //获取系统版本 例如：9.2
        let deviceModelName = UIDevice.current.modelName//extention 获取设备的型号 例如：iPhone
        //customer headers
        var headers = defaultHeaders
        headers.add(name: "X-API-MOBILE-TYPE", value: "iOS")
        headers.add(name: "X-API-MOBILE-VERSION", value: appVersion)
        headers.add(name: "X-API-MOBILE-OPERTATING-VERSION", value: sysVersion)
        headers.add(name: "X-API-MOBILE-DEVICE-MODEL", value: deviceModelName)
        headers.add(name: "X-API-MOBILE-UUID", value: deviceUUID)
        return headers
    }
    static var AuthLoginParam: [String: String] {
        //customer headers
        return ["email": APPConfig.loginInfo.email,
                "password": APPConfig.loginInfo.password,
                "fire_base_token": APPConfig.loginInfo.fcmToken]
    }
}
